/*
 TODO: Add clone impl
 */

#ifndef _LINKEDLIST_H
#define	_LINKEDLIST_H

#include <stdlib.h>

typedef int (*compareFunction) (void*, void*);
typedef void* (*copyFunction) (void*);
typedef void (*freeFunction) (void*);

typedef struct LLNode {
    struct LLNode* next;
    struct LLNode* prev;
    void* data;
} LLNode;

typedef struct LinkedList {
    LLNode* head;
    LLNode* tail;
    unsigned size;
    compareFunction cmpr;
    copyFunction copy;
    freeFunction free;
} LinkedList;

LinkedList* createLinkedList(compareFunction cmpr, copyFunction copy, freeFunction free);
void LLDestroy(LinkedList * list);
unsigned LLSize(LinkedList * list);
int LLIsEmpty(LinkedList * list);
LLNode* LLFind(LinkedList * list, void* itm);
LLNode* LLAdd(LinkedList * list, void* itm);
int LLRemove(LinkedList * list, void* itm);
void LLRemoveNode(LinkedList * list, LLNode* node);

#endif	/* _THREADSAFELINKEDLIST_H */

